/** 
 * @description: TODO (描述这个文件的作用) 
 * Project Name:SysAdmin, File Name:BDSessionListener.java 
 * Copyright (c) 2017, 张新功,Inc.All Rights Reserved. 
*/
package com.shiro;

import java.util.concurrent.atomic.AtomicInteger;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListener;

/** 
 * @description: TODO(描述这个类的作用) 
 * @author 张新功 
 * @date 2017年12月5日 
*/
public class BDSessionListener implements SessionListener {

  private final AtomicInteger sessionCount = new AtomicInteger(0);

  @Override
  public void onStart(Session session) {
    sessionCount.incrementAndGet();
  }

  @Override
  public void onStop(Session session) {
    sessionCount.decrementAndGet();
  }

  @Override
  public void onExpiration(Session session) {
    sessionCount.decrementAndGet();

  }

  public int getSessionCount() {
    return sessionCount.get();
  }

}
